﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Reflection;
using System.IO;

namespace HelloAsp
{
    public partial class HelloASP : System.Web.UI.Page
    {
        const string FILE_NAME = "d:/hello/file.txt";

        protected void Page_PreInit(object sender, EventArgs e)
        {
            StreamWriter streamWriter = new StreamWriter(FILE_NAME);
            using (streamWriter)
            {
                streamWriter.WriteLine("Page_PreInit");
            }
            
        }

        protected void Page_Init(object sender, EventArgs e)
        {
            StreamWriter streamWriter = new StreamWriter(FILE_NAME, true);
            using (streamWriter)
            {
                streamWriter.WriteLine("Page_Init");
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            StreamWriter streamWriter = new StreamWriter(FILE_NAME, true);
            using (streamWriter)
            {
                this.Content.InnerText = Assembly.GetExecutingAssembly().Location;
                streamWriter.WriteLine("PAGE_LOAD");
            }
        }

        protected void Page_PreRender(object sender, EventArgs e)
        {
            StreamWriter streamWriter = new StreamWriter(FILE_NAME, true);
            using (streamWriter)
            {
                streamWriter.WriteLine("Page_PreRender");
            }
        }

        protected override void Render(HtmlTextWriter writer)
        {
            StreamWriter streamWriter = new StreamWriter(FILE_NAME, true);
            using (streamWriter)
            {
                streamWriter.WriteLine("Page_Render");
            }
            base.Render(writer);
        }

        protected void Page_Unload(object sender, EventArgs e)
        {
            StreamWriter streamWriter = new StreamWriter(FILE_NAME, true);
            using (streamWriter)
            {
                streamWriter.WriteLine("Page_Unload");
            }
        }


        
    }
}